package com.aaa.gs.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ fileName:MyRule
 * @ description:
 * @ author:zhz
 * @ createTime:2021/1/12 9:58
 */
@Configuration
public class MyRule {

    /**
     * 负载均衡策略配置
     * @return
     */
    @Bean
    public IRule  iRule(){
        //设置负载均衡策略为随机
        return  new MyRandomRule();
        //轮询
        //return  new RoundRobinRule();
    }
}
